home *** CD-ROM | disk | FTP | other *** search
- # testing if we can send events to a widget
- xtAppInitialize -class Program
-
- proc activateCB {} {
- puts stdout "...activated"
- }
-
- proc disarmCB {} {
- puts stdout "...disarmed"
- }
-
- proc armCB {} {
- puts stdout "...armed"
- }
-
- xtAppInitialize -class Btn
-
- xmPushButton .btn managed -labelString "Hello world"
-
- .btn activateCallback activateCB
- .btn armCallback armCB
- .btn disarmCallback disarmCB
-
- . realizeWidget
-
- puts stdout "calling arm"
- .btn callActionProc Arm()
-
- # activate assumes it comes from a ButtonPress.
- # coords within its boundaries mean ButtonRelease
- # occurs within the widget, so activate callback occurs.
- # outside this, no callback is invoked
-
- # this one is inside boundary
- puts stdout "calling activate"
- .btn callActionProc Activate() \
- -type ButtonPress \
- -x 0 -y 0
-
- puts stdout "calling disarm"
- .btn callActionProc Disarm()
-
- puts stdout "calling armAndActivate"
- .btn callActionProc ArmAndActivate()
-
- . mainLoop
-
- . realizeWidget
-
- . mainLoop
-